<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>线上测试管理</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
</head>
<body>

<div class="container" style="width:96%">
	<table class="table table-bordered table-striped" align="center">
		<tr>
			<td>
				<nav class="navbar navbar-default">
					<div class="navbar-header">
						<span class="navbar-brand">清除用户状态</span>
					</div>
				</nav>
			</td>
		</tr>
		<form action="?do=Clear" method="post" id="clear-form">
			<tr>
				<td class="form-inline" width="20%" colspan="4">
					<div class="input-group">
						<div class="input-group-addon">用户Id</div>
						<input class="form-control" name="uid" value="">
					</div>
					<div class="input-group">
						<input type="checkbox" class="checkbox" name="type[]" value="enroll"> 报名支付
						<input type="checkbox" class="checkbox" name="type[]" value="user_type"> 用户类型
						<input type="checkbox" class="checkbox" name="type[]" value="invite"> 邀请关系
					</div>
					<input type="submit" value="清除" id="btn-submit" class="btn btn-primary"/>
				</td>
			</tr>
		</form>
	</table>
</div>

{literal}
	<script type="application/javascript">
        $("#btn-submit").click(function () {
            var that = $(this),
                reset = function () {
                    that.prop('disabled', false);
                    that.val('清除');
                };
            if ($(this).prop('disabled')) {
                return true;
            }

            $(this).prop('disabled', true);
            $(this).val('提交中...');

            top.swal({
                title: '清除确认',
                text: '请谨慎填写，一旦提交不可撤销!',
                type: "warning",
                showCancelButton: true,
                cancelButtonText: '取消',
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定",
                closeOnConfirm: false
            }, function (isConfirm) {
                if (isConfirm) {
                    $.ajax({
                        url: '?do=Clear',
                        type: "POST",
                        data: $("#clear-form").serialize(),
                        dataType: "json",
                        success: function (json) {
                            setTimeout(function () {
                                top.swal(json);
                            }, 100);
                            if (json.type == 'success') {
                                $("#clear-form").get(0).reset();
                                top.swal('success', json.msg, 'success');
                            } else {
                                top.swal('error', json.msg, 'error');
                            }
                            reset();
                        }
                    });
                } else {
                    reset();
                }

            });
        });
	</script>
{/literal}
</body>
<html>